package com.itheima.controller;

import com.itheima.domain.Department;
import com.itheima.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/*
 *Author:TH
 *Dete:2019/10/1420:28
 */
@Controller
@RequestMapping("/depart")
public class DepartmentController {

    @Autowired
    private DepartmentService departmentService;
    @RequestMapping("/findAll")
    @ResponseBody
    public void findAll(Model model){
        List<Department> departmentList = departmentService.findAll();
        model.addAttribute("departmentList",departmentList);
    }


}
